

/**
 * 公共底部导航
 */
function fixBottomNav(name) {

  //创建ul
  const ul = document.createElement('ul')

  //添加类名
  ul.className = `foot dpflex`;

  //添加HTML内容
  ul.innerHTML = `
<a href = "./home.html" class = "dpflex">
  <li class = "${name === 'home' ? 'active' : ''}">
      <span class="iconfont icon-home"></span>
      <p>首页</p>
  </li>
</a>
<a href="./run.html">
    <li class = "${name === 'run' ? 'active' : ''}">
      <span class="iconfont icon-fitness"></span>
      <p>运动</p>
    </li>
</a>
<a href="./follow.html" class = "dpflex">
   <li class = " ${name === 'follow' ? 'active' : ''}">
      <span class="iconfont icon-Moments"></span>
      <p>圈子</p>
    </li> 
  </a>
<a href="./mine.html" class = "dpflex">
   <li class = " ${name === 'mine' ? 'active' : ''}">
      <span class="iconfont icon-user"></span>
      <p>我的</p>
   </li>
</a>
  `

  //将div追加到body中
  document.body.append(ul)

}


/* //导出对象
module.exports = {
  fixBottomNav
}
 */

/* 公共顶部导航 */
function sportTopNav(name){
  //创建一个ul
  const ul = document.createElement('ul')
  
  //添加类名
  ul.className = `head-nav dpflex`;

  //添加html内容
  ul.innerHTML = `
      <li><a class = "${name === 'run' ? 'active' : ''}" href="./run.html">跑步</a></li>
      <li><a class = "${name === 'ride' ? 'active' : ''}" href="./ride.html">骑行</a></li>
      <li><a class = "${name === 'course' ? 'active' : ''}" href="./course.html">课程训练</a></li>
  `

  //将ul追加到到headNav
  headNav.prepend(ul)
}


//导出对象
module.exports = {
  fixBottomNav,sportTopNav
}
